#!/bin/sh -e
# adapted from devuan

[ "$1" = "prereqs" ] && exit 0

if [ -w /sys/kernel/uevent_helper ]; then
    echo > /sys/kernel/uevent_helper
fi

udevd --daemon --resolve-names=never

udevadm trigger --action=add
udevadm settle || true

if [ -d /sys/bus/scsi ]; then
    modprobe -q scsi_wait_scan && modprobe -r scsi_wait_scan || true
    udevadm settle || true
fi

# If the rootdelay parameter has been set, we wait a bit for devices
# like usb/firewire disks to settle.
if [ "$ROOTDELAY" ]; then
	sleep $ROOTDELAY
fi

# Leave udev running to process events that come in out-of-band (like USB
# connections)
